<!DOCTYPE html>
<html lang='en'>

<head>
  <meta charset='UTF-8'>
  <meta http-equiv='X-UA-Compatible' content='IE=edge'>
  <meta name='viewport' content='width=device-width, initial-scale=1.0'>
  <script src='../giteeApi.js'></script>
  <title>Document</title>
</head>

<body>
  <input value="">12

  <script>

    // 还原Base64到原始字符串  
    function base64ToString(base64String) {
      const binaryString = window.atob(base64String);
      const codeUnits = new Uint8Array(binaryString.length);
      for (let i = 0; i < binaryString.length; i++) {
        codeUnits[i] = binaryString.charCodeAt(i);
      }
      return new TextDecoder().decode(codeUnits);
    }

    geteeApi.Config.confit('xxx', 'zzwuweijun02', 'test-gitee-api');

    geteeApi.Repositories.contents()
      .then(function ({ data }) { console.log(data); })
      .catch(function (error) { console.log(error); });

    // geteeApi.GetData.trees({
    //   sha: 'master',
    //   recursive: 1
    // })
    //   .then(function ({ data }) { console.log(data); })
    //   .catch(function (error) { console.log(error); });

    geteeApi.GetData.blobs({
      sha: '34f3235e540f7ca995ec6cd54567421131ee7009'
    })
      .then(function ({ data }) { console.log(data); data.content && console.log(base64ToString(data.content)) })
      .catch(function (error) { console.log(error); });

  </script>
</body>

</html>